using System;
using Castle.ActiveRecord;
using System.Collections.Generic;
using System.Collections;
using System.Text;



#region 'M_FUNCTIONCATALOG' Schema
/*
 * 'MFunctioncatalog' class maps to 'M_FUNCTIONCATALOG' table.
 * 	 LANGID                  | Type:NVARCHAR2 | Len:10    | Nullable:F | PK:T | FK:F
 * 	 CATALOGID               | Type:NUMBER    | Len:0     | Nullable:F | PK:T | FK:F
 * 	 CATALOGNAME             | Type:NVARCHAR2 | Len:50    | Nullable:T | PK:F | FK:F
 */
#endregion
/// <summary>
///	Generated by MyGeneration using the ActiveRecord Object Mapper - 1.0.2
///	Created on 2011/8/21 10:27:18
/// </summary>
namespace Com.GainWinSoft.ERP.Entity
{
	[Serializable , ActiveRecord("M_FUNCTIONCATALOG")]
	public class CCatalogHasManyFunction : ActiveRecordBase	{

		#region Private Members

        private MFunctioncatalogID id; 
		private string catalogname;
        private string catalogimage;
        private IList functionlist = new List<MFunction>(); 

		#endregion
        
		#region Constuctor(s)
		
		public CCatalogHasManyFunction()
		{
            id = new MFunctioncatalogID();
			catalogname = String.Empty;
            catalogimage = String.Empty;

		}

        public CCatalogHasManyFunction(
			string _langid, 
			int _catalogid)
			: this()
		{
            id = new MFunctioncatalogID();
            id.Catalogid = _catalogid;
            id.Langid = _langid;
			catalogname = String.Empty;
            catalogimage = String.Empty;
		}

		#endregion // End of Class Constuctor(s)
		
		#region Public Properties

		[CompositeKey]
		public virtual MFunctioncatalogID Id
		{
			get { return id; }
			set { id = value; }
		}

		[Property(Column="CATALOGNAME", Length=50)]
		public virtual string Catalogname
		{
			get { return catalogname; }
			set { catalogname = value; }
		}
        [Property(Column = "CATALOGIMAGE", Length = 50)]
        public string Catalogimage
        {
            get { return catalogimage; }
            set { catalogimage = value; }
        }

        [HasMany(typeof(MFunction), Table = "MFunction", CompositeKeyColumnKeys = new string[] { "Langid", "Catalogid" }, OrderBy = "Functionindex")]
        public IList Functionlist
        {
            get { return functionlist; }
            set { functionlist = value; }
        }
		#endregion 

			
		#region Equals, HashCode and ToString overrides
		
		/// <summary>
		/// Local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
            CCatalogHasManyFunction castObj = (CCatalogHasManyFunction)obj;
            return (castObj != null) &&
                (this.id == castObj.id);
		}
		
		/// <summary>
		/// Local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 * hash * id.GetHashCode();
            hash = 27 * hash * catalogname.GetHashCode();
            hash = 27 * hash * catalogimage.GetHashCode();
			return hash; 
		}
		
		/// <summary>
		/// Local implementation of ToString based on class members
		/// </summary>
		public override String ToString()
        {
            StringBuilder sbuffer = new StringBuilder();
			sbuffer.Append("{");
			
			sbuffer.AppendFormat("Langid = {0}, ",id.Langid);
			sbuffer.AppendFormat("Catalogid = {0}, ",id.Catalogid);
			sbuffer.AppendFormat("Catalogname = {0}, ",catalogname);
            sbuffer.AppendFormat("Catalogimage = {0}, ", catalogimage);
			sbuffer.Append(" }");
			return sbuffer.ToString();
        }
		
		#endregion
	}


}
